<template>
  <div class="proview">
    <van-action-bar>
        <van-action-bar-icon icon="chat-o" text="客服" color="#ee0a24" />
        <van-action-bar-icon icon="cart-o" text="购物车" />
        <van-action-bar-icon icon="star" text="已收藏" color="#ff5000" />
        <van-action-bar-button
          type="warning"
          text="加入购物车"
          @click="addToCart"
        />
        <van-action-bar-button type="danger" text="立即购买" />
      </van-action-bar>
  </div>
</template>

<script>
import { doCartAdd } from '@/apis/cart';

export default {
  props:['proid'],
    data(){
      return{
        banners:[],
        proname:"",
        desc:"",
        originprice:999,
        // userid:""
      }
    },
    methods:{
      addToCart(){
        doCartAdd({userid:localStorage.getItem("userid"),proid:this.proid,num:1}).then((res)=>{
         showToast("加入购物车成功")
         console.log(res);
         
          this.$router.push("/cart")
        })
      }
    },
    created(){
      // console.log(this.userid);
      
    }
};
</script>

<style scoped></style>
